<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
  <script src="../../scripts/jquery-1.11.3.min.js"></script>
  <script src="../../scripts/lib/echarts-2.2.7/echarts.js"></script>
  <style>html,body,.chart{height:100%;margin:0;padding:0;}</style>
</head>
<body>
  <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
  <div id="chart1" class="chart"></div>
  <!-- ECharts单文件引入 -->


  <script type="text/javascript">
   $(function() {

    // 路径配置
    require.config({
      paths: {
        echarts: '../../scripts/lib/echarts-2.2.7'
      }
    });

    require(
      [
      'echarts',
            'echarts/chart/wordCloud' // 使用柱状图就加载bar模块，按需加载
            ],
            function(ec) {
            // 基于准备好的dom，初始化echarts图表
            var myChart = ec.init(document.getElementById('chart1'));

            function createRandomItemStyle() {
              return {
                normal: {
                  color: 'rgb(' + [
                    Math.round(Math.random() * 160),
                    Math.round(Math.random() * 160),
                    Math.round(Math.random() * 160)
                    ].join(',') + ')'
}
};
}

option = {
/*  title: {
    text: "事件画像"
  },*/
  tooltip: {
    show: true
  },
  series: [{
    name: '事件画像',
    type: 'wordCloud',
    size: ['80%', '80%'],
    textRotation: [0, 45, 90, -45],
    textPadding: 0,
    autoSize: {
      enable: true,
      minSize: 14
    },
    data: [{
      name: "政治",
      value: 6181,
      itemStyle: createRandomItemStyle()
    }, {
      name: "抢劫",
      value: 4386,
      itemStyle: createRandomItemStyle()
    }, {
      name: "诈骗",
      value: 4055,
      itemStyle: createRandomItemStyle()
    }, {
      name: "赌博",
      value: 2467,
      itemStyle: createRandomItemStyle()
    }, {
      name: "澳门",
      value: 2244,
      itemStyle: createRandomItemStyle()
    }, {
      name: "男",
      value: 1898,
      itemStyle: createRandomItemStyle()
    }, {
      name: "价值观",
      value: 1484,
      itemStyle: createRandomItemStyle()
    }, {
      name: "美帝",
      value: 1112,
      itemStyle: createRandomItemStyle()
    }, {
      name: "宰死猪",
      value: 582,
      itemStyle: createRandomItemStyle()
    }, {
      name: "雷子",
      value: 555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "输",
      value: 582,
      itemStyle: createRandomItemStyle()
    }, {
      name: "下手",
      value: 555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "失手",
      value: 855,
      itemStyle: createRandomItemStyle()
    }, {
      name: "判刑",
      value: 855,
      itemStyle: createRandomItemStyle()
    }, {
      name: "汽车站",
      value: 582,
      itemStyle: createRandomItemStyle()
    }, {
      name: "香港",
      value: 555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "新疆人",
      value: 555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "藏族",
      value: 1582,
      itemStyle: createRandomItemStyle()
    },  {
      name: "达赖",
      value: 1582,
      itemStyle: createRandomItemStyle()
    }, {
      name: "赢",
      value: 1582,
      itemStyle: createRandomItemStyle()
    }, {
      name: "共产党",
      value: 2555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "蔡英文",
      value: 555,
      itemStyle: createRandomItemStyle()
    }, {
      name: "国民党",
      value: 550,
      itemStyle: createRandomItemStyle()
    }]
  }]
};

            // 为echarts对象加载数据
            myChart.setOption(option);
            window.onresize = myChart.resize;
          }
          );

})
</script>
</body>
</html>

